Skip to content

BUG: heightFunction implementation gives wrong results in parallel - #72

Open
gkoukou wants to merge 1 commit into
DLR-RY:masterfrom
gkoukou:fix-heightFunction
Open

BUG: heightFunction implementation gives wrong results in parallel#72
gkoukou wants to merge 1 commit into
DLR-RY:masterfrom
gkoukou:fix-heightFunction

Conversation

@gkoukou

@gkoukou gkoukou commented Aug 25, 2026

Copy link
Copy Markdown

heightFunction::correct() used the mesh average cell delta to calculate curvature. This gives wrong results in cases using AMR where the mesh is locally refined.

In heightFunction::computeColumns, a return statement was added because the iterator would advance even when the current cell was not local anymore, leading to incomplete column.

In case a parallel stencil was found in the primary direction, the code would add it to the parallelStencil list and then continue testing the next direction. A break statement was added to avoid this.

Parallel columns would skip calculation of the first cell across the processor boundary. Finally, K_.correctBoundaryConditions() which is needed for correct interpolation of the curvature field on the faces later.

…d with non-uniform mesh

heightFunction::correct() used the mesh average cell delta to calculate curvature. This
gives wrong results in cases using AMR where the mesh is locally refined.

In heightFunction::computeColumns, a return statement was added because the iterator would
advance even when the current cell was not local anymore, leading to incomplete column.

In case a parallel stencil was found in the primary direction, the code would add it to
the parallelStencil list and then continue testing the next direction. A break statement
was added to avoid this.

Parallel columns would skip calculation of the first cell across the
processor boundary. Finally, K_.correctBoundaryConditions() which is needed for correct
interpolation of the curvature field on the faces later.
@isoAdvector

Copy link
Copy Markdown
Collaborator

Hi @gkoukou

Thank you very much for this contribution!

Would you mind providing a small, simple case (with an Allrun and an Allclean script) exhibiting the bug you fixed, and a description of how to postprocess the case to see the bug (e.g. with a paraview pvsm file)?

Kind regards,
Johan

@gkoukou

gkoukou commented Aug 25, 2026

Copy link
Copy Markdown
Author

Dear professor Roenby,

Thank you for your response.

Here is a case for a translating droplet using static mesh.
advectedCircle.tar.gz

The results look fine until t = 0.12 but then the curvature error spikes. Here is a comparison between the old (top) and new (bottom) implementations.

heightFunction-fix.pdf

The bug can be visualized in paraview by viewing the curvature field K_. Additionally, a plotKrms.gpi gnuplot script is provided in the post/ folder which plots the relative curvature RMS error.

Best regards,
Georgios Koukougkelis

@isoAdvector

Copy link
Copy Markdown
Collaborator

@gkoukou :
I have now confirmed the bug in the master and that the fix works for time step t = 0.16s in the provided case:
image
If I understand correctly, there are several fixes in the PR, some associated with parallel comm and some relating to AMR. Correct? The bug and fix illustrated with your test case is the one relating to parallel comms, since the case does not use AMR, right?

@HenningScheufler :
Would you like to review the code changes before a merge?

@gkoukou

gkoukou commented Aug 26, 2026

Copy link
Copy Markdown
Author

@isoAdvector:
This is correct. The previous test case isolates the parallel communication issue. I have created another case of a static circle with AMR in serial, that isolates the code error when a non-uniform mesh is used.
staticCircle.tar.gz

The circle has a radius of 0.2 so the curvature should evaluate to 5. This is the comparison of the results where the curvature on the left using the original code evaluates to 2.8 while the corrected code on the right gives 5.
bugFix-HF-AMR

Best regards,
Georgios

@isoAdvector

Copy link
Copy Markdown
Collaborator

Thanks for the clarification and the additional test case, @gkoukou
From my side, I am ready to merge.

Awaiting @HenningScheufler having a look at the code changes.

Thanks again for the contribution!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants